package com.qs.rocketmq.right;

import org.apache.rocketmq.client.exception.MQClientException;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@MapperScan("com.qs.rocketmq.right.mapper")
@SpringBootApplication
public class QsRightApplication {

    public static void main(String[] args) throws MQClientException {
        long startTime = System.currentTimeMillis();
        SpringApplication.run(QsRightApplication.class, args);
        System.out.println("启动成功，耗时：" + (System.currentTimeMillis() - startTime) + "ms");

        /*DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("QS_ORDER_CONSUMER_GROUP");
        consumer.setNamesrvAddr("localhost:9876");
        consumer.subscribe("QS_ORDER_APP_TOPIC", "*");
        consumer.registerMessageListener(new MessageListenerConcurrently() {
            @Override
            public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
                System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
                for(MessageExt msg:msgs){
                    System.out.println("msgId:"+msg.getMsgId() + " body:" + new String(msg.getBody()));
                }

                return ConsumeConcurrentlyStatus.RECONSUME_LATER;
            }
        });

        consumer.start();*/
    }
}
